package com.paul.girl.utils;

import com.paul.girl.domain.Result;
import org.springframework.validation.BindingResult;

public class ResultUtil {
    /**
     * 含返回data数据的成功方法
     * @param object
     * @return
     */
    public static Result success(Object object) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功!!!");
        result.setData(object);
        return result;
    }

    /**
     * 不含data的成功的方法
     * @return
     */
    public static Result success() {
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功!!!");
        return result;
    }

    public static Result failed(String msg,Integer code) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
